from abc import ABC, abstractmethod

class AIAssistant(ABC):  # 修复1: 添加ABC继承
    """抽象父类：AI助手（定义通用属性与行为）"""

    def __init__(self, aid: str, name: str, type_: str, version: str, is_online: bool, ability_score: int):
        self.aid = aid  # 使用aid避免与Python内置id冲突
        self.name = name
        self.type = type_  # 使用type_避免与Python关键字冲突
        self.version = version
        self.is_online = is_online
        self.ability_score = ability_score

    @abstractmethod
    def execute_task(self, task_content: str) -> str:
        """执行任务的抽象方法"""
        pass

    # Getter和Setter方法
    def get_id(self) -> str:
        return self.aid

    def set_id(self, aid: str) -> None:
        self.aid = aid

    def get_name(self) -> str:
        return self.name

    def set_name(self, name: str) -> None:
        self.name = name

    def get_type(self) -> str:
        return self.type

    def set_type(self, type_: str) -> None:
        self.type = type_

    def get_version(self) -> str:
        return self.version

    def set_version(self, version: str) -> None:
        self.version = version

    def get_is_online(self) -> bool:  # 修复2: 修改方法名，避免与属性冲突
        return self.is_online

    def set_online(self, online: bool) -> None:
        self.is_online = online

    def get_ability_score(self) -> int:
        return self.ability_score

    def set_ability_score(self, ability_score: int) -> None:
        self.ability_score = ability_score

    def __str__(self) -> str:
        status = "🟢在线" if self.is_online else "🔴离线"
        return f"ID: {self.aid}, 名称: {self.name}, 类型: {self.type}, 版本: {self.version}, 状态: {status}, 能力评分: {self.ability_score} [{self.type}助手]"